  
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="admin" />
        <title>Edit Group</title>
    </head>
    <body>
		<div id="center-column">
			<div class="top-bar">
				<g:link class="button" action="create">ADD NEW</g:link>
				<h1>Edit Group</h1>
				<div class="breadcrumbs">
					<a class="home" href="${resource(dir:'')}">Home</a> / 
					<g:link class="list" action="list">Group List</g:link> /
					<g:link class="create" action="create">New Group</g:link>
				</div>
			</div><br />
			<div class="select-bar-border-no"></div>
	        <div class="body">
	            <g:form controller="group" method="post" >
	                <input type="hidden" name="id" value="${group?.id}" />
		            <div class="dialog">
			            <div class="subdialog">
			            	<h2>Group</h2>
	                        <p class='value ${hasErrors(bean:group,field:'name','errors')}'>
	                            <label for='name'>Name:</label>
	                           	<input type="text" id='name' name='name' value="${group?.name?.encodeAsHTML()}"/>
	                        </p>
			            </div>
		            </div>
		            <div class="dialog">
			            <div class="subdialog">
			            	<h2>Users</h2>
			                <table>
			                    <thead>
			                        <tr>
			                   	        <g:sortableColumn property="username" title="Username" />
			                   	        <g:sortableColumn property="firstname" title="Firstname" />
			                   	        <g:sortableColumn property="lastname" title="Lastname" />
			                        </tr>
			                    </thead>
			                    <tbody>
		                        <g:each in="${users}" status="i" var="user">
									<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
		                         		<td><g:link controller="user" action="show" id="${user.id}">${user.username?.encodeAsHTML()}</g:link></td>
		                         		<td>${user.firstname?.encodeAsHTML()}</td>
		                         		<td>${user.lastname?.encodeAsHTML()}</td>
		                            </tr>
		                        </g:each>
			                    </tbody>
			                </table>
					        <span class="buttons"><g:link class="create" controller='group' params='["id":group?.id]' action='addUsersToGroup'>Manage Group Users</g:link></span>
			            </div>
		            </div>
	                <div class="buttons">
	                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
	                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
	                </div>
	            </g:form>
	        </div>
        </div>
		<div id="right-column">
            <g:if test="${flash.message}">
				<strong class="h">INFO</strong>
	            <div class="box">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${group}">
				<strong class="h">ERROR</strong>
                <g:renderErrors bean="${group}" as="list" />
            </g:hasErrors>
		</div>
    </body>
</html>
